home *** CD-ROM | disk | FTP | other *** search
- This ARC contains a couple of files that illustrate how to handle the type of
- ^C handling discussed in a recent thread on the MSOFT Forum of CompuServe.
-
- Hitting Ctrl-Break has the same effect as ^C, as can be seen by running the
- test program.
-
- A sample replacement function for getch is provided illustrating how to get
- characters and post the INT 23 (control-C exception). Users can feel free
- to modify it to serve their own purposes.
-
- According to Advanced MS-DOS, you cannot post INT 23 yourself. You certainly
- cannot post it with the C runtime routines (see messages below), but you can
- apparently post it properly with the MASM routine included in this ARC file.
-
- However, for some reason that I decided not to trace, you MUST restore the
- signal after taking it, as illustrated in the demonstration program. It is
- not properly reset to the standard processing, SIG_DFL, but seems to be reset
- to SIG_IGN.
-
- Much thanks for Richard Shupak for pushing me to rewrite the MASM code a few
- times before public release; the last time to allow CV walkbacks.
-
- Questions and comments can be made to the author via the MSOFT forum on
- CompuServe. Address messages to: Noel J. Bergman 73220,1030.
-
- The original question and the response documenting this ARC is as follows:
-
- --------------
-
- S3/C & MASM 25-Jul-87 23:29:54
- Sb: Ctrl-C & Ctrl-Break
-
- I have a question about C's handling of the Ctrl-C and Ctrl-Break. How can I
- prevent the ^C from being displayed. I am using the signal fuction pointing to
- an empty fucntion to prevent my program from being aborted during these
- keystrokes. I have not found a way to supress the ^C from being printed. I
- also tried trapping the BIOS Ctrl-Brake interrupt, but it doesn't work for
- Ctrl-C.
- Thanks
-
-
-
- S3/C & MASM 26-Jul-87 13:37:22
- Sb: #70922-Ctrl-C & Ctrl-Break
-
- The only way I know of to do that is to use a function such as #7, which
- doesn't perform ^C processing, and to issue the INT 23 yourself. If you use
- DOS #8, you get the ^C echo.
-
- Unfortunately, you can't just issue an int86(0x23, ..., ...) call from C,
- despite the example on page 242 of the C runtime reference. It just won't
- work. However, I do have a MASM routine that seems to make it work out ok.
-
- For some reason that I am not going to trace, if you use my example the signal
- is not automatically reset to SIG_DFL after each processing; it ends up that
- there is no processing of the signal at all. So you MUST reset the signal
- within your handler and you are completely responsible for determining when
- you want the program to terminate.
-
- I will upload an ARC with the MASM code and a little test program later today.
- If and when the Sysops decide to make it public, there should be a public
- message saying it is available.
-
- --------------
-